package com.jsaas.core.handler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jfinal.handler.Handler;

/**   
* @Title: SessionIdHandler.java 
* @Package com.jsaas.core.handler 
* @Description: TODO(解决路径带jsessionid导致 jfinal404问题) 
* @author tuozq 
* @date 2017年11月3日 下午5:47:47 
* @version V1.0   
*/
public class SessionIdHandler extends Handler {
	
	private final String JSESSIONID = ";JSESSIONID";
	
	@Override
	public void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) {
		// TODO Auto-generated method stub
		boolean isFromURL = target.indexOf(JSESSIONID) != -1;
        if (isFromURL) {
            target = target.substring(0, target.indexOf(JSESSIONID));
        }
        next.handle(target, request, response, isHandled);
	}

}
